package com.hefeng.service.impl;


import com.hefeng.domain.WxBanner;
import com.hefeng.mapper.WxBannerMapper;
import com.hefeng.service.WxBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;


/**
 * 轮播图信息Service业务层处理
 *
 * @author ruoyi
 * @date 2022-08-23
 */
@Service
public class WxBannerServiceImpl implements WxBannerService {

    @Autowired
    private WxBannerMapper wxBannerMapper;

    /**
     * 查询轮播图信息
     *
     * @param bannerId 轮播图信息主键
     * @return 轮播图信息
     */
    @Override
    public WxBanner selectWxBannerByBannerId(Integer bannerId) {
        return wxBannerMapper.selectWxBannerByBannerId(bannerId);
    }

    /**
     * 查询轮播图信息列表
     *
     * @param wxBanner 轮播图信息
     * @return 轮播图信息
     */
    @Override
    public List<WxBanner> selectWxBannerList(WxBanner wxBanner) {
        List<WxBanner> list = wxBannerMapper.selectWxBannerList(wxBanner);
        System.out.println(list.toString() + "======");
        return list;
    }


    /**
     * 新增轮播图信息
     *
     * @param wxBanner 轮播图信息
     * @return 结果
     */
    @Override
    public int insertWxBanner(WxBanner wxBanner) {
        wxBanner.setCreatedTime(new Date());
        wxBanner.setIsDeleted(1);
        wxBanner.setBannerState(1);
        return wxBannerMapper.insertWxBanner(wxBanner);
    }

    /**
     * 修改轮播图信息
     *
     * @param wxBanner 轮播图信息
     * @return 结果
     */
    @Override
    public int updateWxBanner(WxBanner wxBanner) {
        wxBanner.setUpdatedTime(new Date());
        return wxBannerMapper.updateWxBanner(wxBanner);
    }


    /**
     * 删除轮播图信息信息
     *
     * @param bannerId 轮播图信息主键
     * @return 结果
     */
    @Override
    public int deleteWxBannerByBannerId(Integer bannerId) {
        return wxBannerMapper.deleteWxBannerByBannerId(bannerId);
    }
}
